package com.asset.dispoal.channel;

import com.asset.dispoal.channel.api.SysChannelService;
import com.asset.dispoal.channel.dto.SysChannelDebtRequest;
import com.asset.dispoal.channel.dto.SysChannelOpenRequest;
import com.asset.dispoal.channel.dto.SysChannelPayRequest;
import com.asset.dispoal.channel.dto.SysChannelRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/3/25$
 */
@RestController
@Api(value = "渠道管理", tags = "渠道管理")
@RequestMapping("sys/sysChannel")
public class SysChannelController {

    @Autowired
    SysChannelService sysChannelService;

    @PostMapping("insert")
    @ApiOperation(value = "新增", notes = "新增")
    public Result insert(@RequestBody SysChannelRequest request) {
        return sysChannelService.insert(request);
    }

    @PostMapping("update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody SysChannelRequest request) {
        return sysChannelService.update(request);
    }

    @GetMapping("delete")
    @ApiOperation(value = "删除", notes = "删除")
    public Result delete(String id) {
        return sysChannelService.delete(id);
    }

    @GetMapping("queryPage")
    @ApiOperation(value = "分页查询", notes = "分页查询")
    public Result queryPage(SysChannelRequest request) {
        return sysChannelService.queryPage(request);
    }

    @PostMapping("debtInsert")
    @ApiOperation(value = "欠款新增", notes = "欠款新增")
    public Result debtInsert(@RequestBody SysChannelDebtRequest request) {
        return sysChannelService.debtInsert(request);
    }

    @PostMapping("debtUpdate")
    @ApiOperation(value = "欠款修改", notes = "欠款修改")
    public Result debtUpdate(@RequestBody SysChannelDebtRequest request) {
        return sysChannelService.debtUpdate(request);
    }

    @GetMapping("debtDelete")
    @ApiOperation(value = "欠款删除", notes = "欠款删除")
    public Result debtDelete(String id) {
        return sysChannelService.debtDelete(id);
    }

    @GetMapping("debtQueryPage")
    @ApiOperation(value = "欠款分页查询", notes = "欠款分页查询")
    public Result debtQueryPage(SysChannelDebtRequest request) {
        return sysChannelService.debtQueryPage(request);
    }

    @PostMapping("openInsert")
    @ApiOperation(value = "开票新增", notes = "开票新增")
    public Result openInsert(@RequestBody SysChannelOpenRequest request) {
        return sysChannelService.openInsert(request);
    }

    @PostMapping("openUpdate")
    @ApiOperation(value = "开票修改", notes = "开票修改")
    public Result openUpdate(@RequestBody SysChannelOpenRequest request) {
        return sysChannelService.openUpdate(request);
    }

    @GetMapping("openDelete")
    @ApiOperation(value = "开票删除", notes = "开票删除")
    public Result openDelete( String id) {
        return sysChannelService.openDelete(id);
    }

    @GetMapping("openQueryPage")
    @ApiOperation(value = "开票分页查询", notes = "开票分页查询")
    public Result openQueryPage(SysChannelOpenRequest request) {
        return sysChannelService.openQueryPage(request);
    }


    @PostMapping("payInsert")
    @ApiOperation(value = "支付新增", notes = "支付新增")
    public Result payInsert(@RequestBody SysChannelPayRequest request) {
        return sysChannelService.payInsert(request);
    }

    @PostMapping("payUpdate")
    @ApiOperation(value = "支付修改", notes = "支付修改")
    public Result payUpdate(@RequestBody SysChannelPayRequest request) {
        return sysChannelService.payUpdate(request);
    }

    @GetMapping("payDelete")
    @ApiOperation(value = "支付删除", notes = "支付删除")
    public Result payDelete( String id) {
        return sysChannelService.payDelete(id);
    }

    @GetMapping("payQueryAll")
    @ApiOperation(value = "支付分页查询", notes = "支付分页查询")
    public Result payQueryAll(SysChannelPayRequest request) {
        return sysChannelService.payQueryAll(request);
    }
}